// import "@babel/polyfill";
import "./style/main.less";

let second = () => {
  return new Promise((resolve, reject) => {
    let obj = {};
    Date.now() % 2 ? (obj.time = new Date()) : delete obj.time;
    if (obj.time?.getSeconds()) {
      console.log(obj.time);
      resolve(obj);
    } else {
      reject("奇数时");
    }
  });
};

document.body.onclick = () => {
  second()
    .then((res) => {
      alert(res.time.getSeconds());
    })
    .catch((err) => {
      alert(err);
    });
};
